2. Database Files and Their Location
The placement of your database
files is critical to your SharePoint performance. When installing SQL
Server, a default path is provided for your data and transaction log
files. Usually, however, you will never want to use the default path.
Instead, you should configure your SQL Server instance to modify the
default database location, thereby improving performance. The types of
files you will find here are introduced in this section.
2.1. Database Files
There are three types
of files associated with a SQL Server database. Each database will have
two of these files; the third file type is optional and may be used if
you want to have multiple files associated with a single database. The three files associated with a database are
Primary data file
The primary data file is the starting point of the database and points
to the other files in the database. Every database has one primary data
file. The recommended file name extension for primary data files is
.mdf.
Transaction log files
Transaction log files hold all data modifications made to the primary
data file and can be used to recover the database. You must have at
least one log file for each database, although you can have more than one. The recommended file name extension for log files is .ldf.
Secondary data files
Secondary data files are optional, but they include all other data
files associated with a database. The recommended file name extension
for secondary data files is .ndf.
Note:
SQL
Server does not enforce the .mdf, .ndf, and .ldf file name extensions,
but the consistency of these file extensions will help you, as well as
anyone else who may work with this instance of SQL Server, easily
identify the different kinds of files.
2.2. Storage Options
There are several options
to consider when determining where your SQL Server files will be stored
to provide optimal performance while balancing costs. The following
storage options are the three most common.
Network Attached Storage (NAS)
Typically, this option has a high read and write I/O latency on a
storage subsystem based on NAS or iSCSI technology. Not the most
popular option, but it is available for your consideration.
Storage Area Network (SAN)
This allows you to spread I/O across every disk that is part of this
storage option, but it can be adversely affected by read-intensive
operations such as a full crawl. Generally, you want your SharePoint
storage subsystem separate from all other applications and not have any
shared storage, as you may have with a SAN because of the costs
involved.
Direct Attached Storage (DAS)
DAS storage subsystems are cheaper, easier to maintain, and provide the
SharePoint/SQL Administrator more control over virtual storage
performance. It is a simple yet effective storage solution that is
often less expensive than a SAN. You can also use expandable storage
arrays that are basically “advanced” DAS systems. These systems
function like a DAS, but they provide the added benefit of dual node
(cluster) support.
2.3. Default Database Location
By default, your SharePoint database files are created on drive C of the SQL Server 2008 installation in the following directory.
C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\
To improve performance and provide redundancy for your SharePoint content, you will want to place the database
files elsewhere. You should place your data and transaction log files
on a RAID 5 or RAID 10 array that will provide data redundancy so you
will not lose any data if there is a disk failure. RAID arrays provide redundancy through data striping, mirroring, or a combination of both.
If a RAID array is not an
option, you should at least separate your data files (.mdf) and
transaction log files (.ldf) on different physical drives. By doing so,
you will be able to recover the database if the hard drive containing
the primary data file fails; you can do this by performing a
transaction log restore. This configuration also increases I/O
performance by reducing the large amount of read/write contention
between the two file types. Data files are constantly written to and
read from in an Online Transaction Processing (OLTP) environment, while
transaction log files are typically only written to, and done so
sequentially.
If you are unsure where
your database files are located, you can access the properties of the
database from within SQL Server Management Studio as shown in Figure 2.
USE ContosoPortal_Content
SELECT * FROM sysfiles
GO
To make sure your databases are
created on a RAID array or that the data files and transaction log
files are located on different physical drives, you can modify the SQL
Server Database Default Locations settings as shown in Figure 3.
Note:
This setting does not
affect existing databases—it affects only new databases created after
the change to the Database Default Locations settings was made. To move
existing databases, you have to detach, copy, and reattach the
databases in SQL Server.
|